<template>
	<!--
    	作者：1550495493@qq.com
    	时间：2019-08-17
    	描述：工作状态
    -->
	<div class="PressRelease">
		<div class="search-box">
			<div class="fl">
				<input @click="manually()" class="btn-boxs" type="button" value="人工录入" />
			</div>
			<div class="fr">
				<input name="search" class="search" type="text" autocomplete="off" v-model="search" />
				<input class="btn" type="button" value="搜索" @click="searchTodo" />
			</div>
		</div>
		<div class="PressRelease-list">
			<table>
				<thead>
					<tr>
						<th class="table-text-th2">资料名称</th>
						<th class="table-text-th1">文本资料</th>
						<th class="table-text-th1">图片资料</th>
						<th class="table-text-th1">视频资料</th>
						<th class="table-text-th3">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-if="materialList.length == 0">
						<td colspan="5" class="center">暂无数据！</td>
					</tr>
					<tr v-for="material in materialList">
						<td>{{material.name}}</td>
						<td><input type="button" value="下载" class="delete write" @click="downloadPack(material.textMaterial)" /></td>
						<td><input type="button" value="下载" class="delete write" @click="downloadPack(material.imgMaterial)" /></td>
						<td><input type="button" value="下载" class="delete write" @click="downloadPack(material.vdioMaterial)" /></td>
						<td>
							<input @click="manually(material)" type="button" value="修改" class="delete write" />
							<input @click="toView(material)" type="button" value="查看" class="delete write" />
						</td>
					</tr>
				</tbody>
			</table>
			<!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
			<pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
		</div>

		<!-- 人工录入-模态框-->
		<div v-show="ApplicationStatus" class="tenant-model">
			<div class="tenant-model-content Application input">
				<header class="tenant-model-header">
					<h3>人工录入</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<!--模态框内容板块-->
						<form class="form-box" id="materialForm">
							<input type="hidden" name="id" :value="material.id" />
							<div class="form-line input-required">
								<label>资料名称：</label>
								<div class="input-box">
									<input type="text" name="name" v-model="material.name">
								</div>
							</div>
							<input type="reset" style="display: none" />
						</form>
						<div class="tab-tit">
							<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">文本</a>
							<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">图像</a>
							<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">音视频</a>
						</div>
						<div class="tab-con">
							<div v-show="curId===0">

								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<!--<th>附件</th>-->
										<th>在线预览</th>
										<th>操作</th>
									</tr>
									<tr v-if="textMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="(fileInfo,index) in textMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<!--<td>
											<input type="button" value="上传" class="delete" />
										</td>-->
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="删除" class="delete write" @click="deleteMaterial(0,index)" />
										</td>
									</tr>
								</table>
								<input type="button" value="上传" class="delete write" @click="$refs.textFile.click()" />
								<input type="file" ref="textFile" @change="idFrontImg(0)" style="display: none" accept=".txt,.rar,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.exe" />
							</div>
							<div v-show="curId===1">
								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<!--<th>附件</th>-->
										<th>在线预览</th>
										<th>操作</th>
									</tr>
									<tr v-if="imgMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="(fileInfo,index) in imgMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<!--<td>
											<input type="button" value="上传" class="delete" />
										</td>-->
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="删除" class="delete write" @click="deleteMaterial(1,index)" />
										</td>
									</tr>
								</table>
								<input type="button" value="上传" class="delete write" @click="$refs.imgFile.click()" />
								<input type="file" ref="imgFile" @change="idFrontImg(1)" style="display: none" accept="image/*" />
							</div>
							<div v-show="curId===2">

								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<!--<th>附件</th>-->
										<th>在线预览</th>
										<th>操作</th>
									</tr>
									<tr v-if="vdioMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="fileInfo in vdioMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<!--<td>
											<input type="button" value="上传" class="delete" />
										</td>-->
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="删除" class="delete write" @click="deleteMaterial(2,index)" />
										</td>
									</tr>
								</table>
								<input type="button" value="上传" class="delete write" @click="$refs.vdioFile.click()" />
								<input type="file" ref="vdioFile" @change="idFrontImg(2)" style="display: none" accept=".mp3,.mp4,.wav,.flv,.avl" />
							</div>
						</div>
					</div>
				</div>
				<footer class="tenant-model-footer">
					<button class="determine" @click="saveData" v-if="material.id == null || material.id == ''">确认</button>
					<button class="determine" @click="updateData" v-else>保存</button>
				</footer>
			</div>
		</div>
		<!--查看-模态框-->
		<div v-if="Application" class="tenant-model">
			<div class="tenant-model-content ApplicationStatus">
				<header class="tenant-model-header">
					<h3>查看</h3>
					<span @click="closeModel" class="closeModel">×</span>
				</header>
				<div class="tenant-model-body">
					<div class="search-contain">
						<div class="tab-tit">
							<a href="javascript:;" @click="curId=0" :class="{'cur':curId===0}">文本</a>
							<a href="javascript:;" @click="curId=1" :class="{'cur':curId===1}">图像</a>
							<a href="javascript:;" @click="curId=2" :class="{'cur':curId===2}">音视频</a>
						</div>
						<div class="tab-con">
							<div v-show="curId===0">
								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<th>附件</th>
										<th>在线预览</th>
									</tr>
									<tr v-if="textMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="fileInfo in textMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<td>
											<input type="button" value="下载" class="delete write" @click="download(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
									</tr>
								</table>
							</div>
							<div v-show="curId===1">
								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<th>附件</th>
										<th>在线预览</th>
									</tr>
									<tr v-if="imgMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="fileInfo in imgMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<td>
											<input type="button" value="下载" class="delete" @click="download(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
									</tr>
								</table>
							</div>
							<div v-show="curId===2">
								<table>
									<tr>
										<th>文本名称</th>
										<th>文本格式</th>
										<th>文本大小</th>
										<th>附件</th>
										<th>在线预览</th>
									</tr>
									<tr v-if="vdioMaterialList.length == 0">
										<td colspan="5" class="center">暂无数据！</td>
									</tr>
									<tr v-for="fileInfo in vdioMaterialList">
										<td>{{fileInfo.name}}</td>
										<td>{{fileInfo.suffix}}</td>
										<td>{{fileInfo.size}}</td>
										<td>
											<input type="button" value="下载" class="delete write" @click="download(fileInfo.url)" />
										</td>
										<td>
											<input type="button" value="查看" class="delete write" @click="preview(fileInfo.url)" />
										</td>
									</tr>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

</template>
<script src="./database.js"></script>

<style scoped>
	@import "database.css"
</style>
